package newcoder_exp.justPractise;

import java.util.PriorityQueue;
import java.util.*;
import org.junit.*;

public class NC111 {
    public class Solution {
        //拼接为最大数
        public String solve (int[] nums) {
            Queue<String> queue = new PriorityQueue<>((s1, s2) -> (s2 + s1).compareTo(s1 + s2));
            for (int i = 0; i < nums.length; i++) {
                queue.offer(nums[i] + "");
            }

            String res = "";
            while (!queue.isEmpty()) {
                res = res.equals("0") ? queue.poll() : res + queue.poll();
            }
            return res;
        }
    }

    @Test
    public void test() {
        Solution s = new Solution();
        int[] nums = new int[]{0, 0};
        System.out.println(s.solve(nums));
        
    }
}
